home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Magazine / Morphos / GCC / ppc-amigaos / include / mgl / gl.h < prev    next >
C/C++ Source or Header  |  2000-01-22  |  26KB  |  645 lines

  1. /*
  2.  * $Id: gl.h,v 1.6 2000/01/16 20:47:09 hfrieden Exp $
  3.  *
  4.  * $Author: hfrieden $
  5.  *
  6.  * $Date: 2000/01/16 20:47:09 $
  7.  * $Revision: 1.6 $
  8.  *
  9.  * (C) 1999 by Hyperion Software
  10.  * All rights reserved
  11.  *
  12.  * This file is part of the MiniGL library project
  13.  * See the file Licence.txt for more details
  14.  *
  15.  */
  16.  
  17. #ifndef GL_H_
  18. #define GL_H_
  19.  
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24.  
  25. #ifdef __PPC__
  26. #define mykprintf kprintf
  27. #endif
  28.  
  29. #include "mgl/config.h"
  30. #include "log.h"
  31.  
  32. #ifndef NLOGGING
  33. extern int MGLDebugLevel;
  34. #define mglSetDebugLevel(level) \
  35.     MGLDebugLevel = level
  36. #endif
  37.  
  38. /*
  39.     GL types
  40. */
  41.  
  42. typedef void            GLvoid;
  43. typedef unsigned char   GLboolean;
  44. typedef char            GLbyte;
  45. typedef unsigned char   GLubyte;
  46. typedef short           GLshort;
  47. typedef unsigned short  GLushort;
  48. typedef int             GLint;
  49. typedef unsigned int    GLuint;
  50. typedef long            GLsizei;
  51. typedef unsigned long   GLbitfield;
  52. typedef float           GLfloat;
  53. typedef double          GLdouble;
  54. typedef float           GLclampf;
  55. typedef double          GLclampd;
  56. typedef int             GLenum;
  57.  
  58.  
  59. /*
  60.     GL enum
  61.     Currently a dummy
  62. */
  63.  
  64. enum
  65. {
  66.     GL_BASE             = 0,
  67.  
  68.     GL_ALPHA,
  69.     GL_ALPHA8,
  70.     GL_ALPHA_BITS,
  71.     GL_ALPHA_SCALE,
  72.     GL_ALPHA_TEST,
  73.     GL_ALPHA_TEST_FUNC,
  74.     GL_ALPHA_TEST_REF,
  75.     GL_ALWAYS,
  76.     GL_AUX_BUFFERS,
  77.     GL_BACK,
  78.     GL_BACK_LEFT,
  79.     GL_BACK_RIGHT,
  80.     GL_BLEND,
  81.     GL_BLEND_DST,
  82.     GL_BLEND_SRC,
  83.     GL_BLUE,
  84.     GL_BLUE_BITS,
  85.     GL_BYTE,
  86.     GL_C3F_V3F,
  87.     GL_C4UB_V2F,
  88.     GL_C4UB_V3F,
  89.     GL_CCW,
  90.     GL_COLOR_ARRAY,
  91.     GL_COLOR_ARRAY_POINTER,
  92.     GL_COLOR_ARRAY_SIZE,
  93.     GL_COLOR_ARRAY_STRIDE,
  94.     GL_COLOR_ARRAY_TYPE,
  95.     GL_COLOR_CLEAR_VALUE,
  96.     GL_COLOR_INDEX,
  97.     GL_CULL_FACE,
  98.     GL_CULL_FACE_MODE,
  99.     GL_CURRENT_COLOR,
  100.     GL_CURRENT_INDEX,
  101.     GL_CURRENT_TEXTURE_COORDS,
  102.     GL_CW,
  103.     GL_DECAL,
  104.     GL_DEPTH_BITS,
  105.     GL_DEPTH_CLEAR_VALUE,
  106.     GL_DEPTH_COMPONENT,
  107.     GL_DEPTH_FUNC,
  108.     GL_DEPTH_RANGE,
  109.     GL_DEPTH_SCALE,
  110.     GL_DEPTH_TEST,
  111.     GL_DEPTH_WRITEMASK,
  112.     GL_DITHER,
  113.     GL_DONT_CARE,
  114.     GL_DOUBLE,
  115.     GL_DOUBLEBUFFER,
  116.     GL_DRAW_BUFFER,
  117.     GL_DST_ALPHA,
  118.     GL_DST_COLOR,
  119.     GL_EDGE_FLAG,
  120.     GL_EDGE_FLAG_ARRAY,
  121.     GL_EDGE_FLAG_ARRAY_POINTER,
  122.     GL_EDGE_FLAG_ARRAY_STRIDE,
  123.     GL_EQUAL,
  124.     GL_EXTENSIONS,
  125.     GL_FASTEST,
  126.     GL_FLAT,
  127.     GL_FLOAT,
  128.     GL_FOG,
  129.     GL_FOG_COLOR,
  130.     GL_FOG_DENSITY,
  131.     GL_FOG_END,
  132.     GL_FOG_HINT,
  133.     GL_FOG_INDEX,
  134.     GL_FOG_MODE,
  135.     GL_FOG_START,
  136.     GL_FRONT_AND_BACK,
  137.     GL_FRONT,
  138.     GL_FRONT_FACE,
  139.     GL_FRONT_LEFT,
  140.     GL_FRONT_RIGHT,
  141.     GL_GEQUAL,
  142.     GL_GREATER,
  143.     GL_GREEN,
  144.     GL_GREEN_BITS,
  145.     GL_INDEX_ARRAY,
  146.     GL_INDEX_ARRAY_POINTER,
  147.     GL_INDEX_ARRAY_STRIDE,
  148.     GL_INDEX_ARRAY_TYPE,
  149.     GL_INDEX_BITS,
  150.     GL_INDEX_CLEAR_VALUE,
  151.     GL_INDEX_MODE,
  152.     GL_INT,
  153.     GL_INTENSITY,
  154.     GL_INTENSITY8,
  155.     GL_INVALID_ENUM,
  156.     GL_INVALID_OPERATION,
  157.     GL_INVALID_VALUE,
  158.     GL_LEFT,
  159.     GL_LEQUAL,
  160.     GL_LESS,
  161.     GL_LINEAR,
  162.     GL_LINEAR_MIPMAP_LINEAR,
  163.     GL_LINEAR_MIPMAP_NEAREST,
  164.     GL_LINES,
  165.     GL_LINE_LOOP,
  166.     GL_LINE_STRIP,
  167.     GL_LUMINANCE,
  168.     GL_LUMINANCE8,
  169.     GL_LUMINANCE8_ALPHA8,
  170.     GL_LUMINANCE_ALPHA,
  171.     GL_MATRIX_MODE,
  172.     GL_MAX_TEXTURE_SIZE,
  173.     GL_MAX_VIEWPORT_DIMS,
  174.     GL_MODELVIEW,
  175.     GL_MODELVIEW_MATRIX,
  176.     GL_MODELVIEW_STACK_DEPTH,
  177.     GL_MODULATE,
  178.     GL_NEVER,
  179.     GL_NEAREST,
  180.     GL_NEAREST_MIPMAP_NEAREST,
  181.     GL_NEAREST_MIPMAP_LINEAR,
  182.     GL_NICEST,
  183.     GL_NONE,
  184.     GL_NOTEQUAL,
  185.     GL_NO_ERROR,
  186.     GL_ONE,
  187.     GL_ONE_MINUS_DST_ALPHA,
  188.     GL_ONE_MINUS_DST_COLOR,
  189.     GL_ONE_MINUS_SRC_ALPHA,
  190.     GL_ONE_MINUS_SRC_COLOR,
  191.     GL_OUT_OF_MEMORY,
  192.     GL_PACK_ALIGNMENT,
  193.     GL_PACK_LSB_FIRST,
  194.     GL_PACK_ROW_LENGTH,
  195.     GL_PACK_SKIP_PIXELS,
  196.     GL_PACK_SKIP_ROWS,
  197.     GL_PACK_SWAP_BYTES,
  198.     GL_PERSPECTIVE_CORRECTION_HINT,
  199.     GL_POINTS,
  200.     GL_POLYGON_MODE,
  201.     GL_POLYGON_OFFSET,
  202.     GL_POLYGON_OFFSET_FACTOR,
  203.     GL_POLYGON_OFFSET_FILL,
  204.     GL_POLYGON_OFFSET_LINE,
  205.     GL_POLYGON_OFFSET_POINT,
  206.     GL_POLYGON_OFFSET_UNITS,
  207.     GL_POLYGON,
  208.     GL_PROJECTION,
  209.     GL_PROJECTION_MATRIX,
  210.     GL_PROJECTION_STACK_DEPTH,
  211.     GL_QUADS,
  212.     GL_QUAD_STRIP,
  213.     GL_READ_BUFFER,
  214.     GL_RED,
  215.     GL_RED_BITS,
  216.     GL_RENDERER,
  217.     GL_REPLACE,
  218.     GL_REPEAT,
  219.     GL_RGB,
  220.     GL_RGB5,
  221.     GL_RGB5_A1,
  222.     GL_RGB8,
  223.     GL_RGBA,
  224.     GL_RGBA8,
  225.     GL_RGBA_MODE,
  226.     GL_RIGHT,
  227.     GL_SCISSOR_BOX,
  228.     GL_SCISSOR_TEST,
  229.     GL_SHADE_MODEL,
  230.     GL_SHORT,
  231.     GL_SMOOTH,
  232.     GL_SRC_ALPHA,
  233.     GL_SRC_ALPHA_SATURATE,
  234.     GL_SRC_COLOR,
  235.     GL_STACK_OVERFLOW,
  236.     GL_STACK_UNDERFLOW,
  237.     GL_STEREO,
  238.     GL_T2F_C3F_V3F,
  239.     GL_T2F_C4UB_V3F,
  240.     GL_T2F_V3F,
  241.     GL_TABLE_TOO_LARGE,
  242.     GL_TEXTURE_2D,
  243.     GL_TEXTURE_2D_BINDING,
  244.     GL_TEXTURE_COORD_ARRAY,
  245.     GL_TEXTURE_COORD_ARRAY_SIZE,
  246.     GL_TEXTURE_COORD_ARRAY_STRIDE,
  247.     GL_TEXTURE_COORD_ARRAY_TYPE,
  248.     GL_TEXTURE_DOOR_ARRAY_POINTER,
  249.     GL_TEXTURE_ENV,
  250.     GL_TEXTURE_ENV_COLOR,
  251.     GL_TEXTURE_ENV_MODE,
  252.     GL_TEXTURE_MAG_FILTER,
  253.     GL_TEXTURE_MIN_FILTER,
  254.     GL_TEXTURE_PRIORITY,
  255.     GL_TEXTURE_WRAP_S,
  256.     GL_TEXTURE_WRAP_T,
  257.     GL_TEXTURE_GEN_S,
  258.     GL_TEXTURE_GEN_T,
  259.     GL_TRIANGLES,
  260.     GL_TRIANGLE_FAN,
  261.     GL_TRIANGLE_STRIP,
  262.     GL_UNPACK_ALIGNMENT,
  263.     GL_UNPACK_LSB_FIRST,
  264.     GL_UNPACK_ROW_LENGTH,
  265.     GL_UNPACK_SKIP_PIXELS,
  266.     GL_UNPACK_SKIP_ROWS,
  267.     GL_UNPACK_SWAP_BYTES,
  268.     GL_UNSIGNED_BYTE,
  269.     GL_UNSIGNED_INT,
  270.     GL_UNSIGNED_SHORT,
  271.     GL_V2F,
  272.     GL_V3F,
  273.     GL_VENDOR,
  274.     GL_VERSION,
  275.     GL_VERTEX_ARRAY,
  276.     GL_VERTEX_ARRAY_POINTER,
  277.     GL_VERTEX_ARRAY_SIZE,
  278.     GL_VERTEX_ARRAY_STRIDE,
  279.     GL_VERTEX_ARRAY_TYPE,
  280.     GL_VIEWPORT,
  281.     GL_ZERO,
  282.     GL_POINT_SMOOTH,
  283.     GL_CLAMP,
  284.     GL_EXP,
  285.     GL_EXP2,
  286.     GL_TEXTURE_GEN_MODE,
  287.     GL_SPHERE_MAP,
  288.     GL_T,
  289.     GL_S,
  290.     GL_FILL,
  291. #ifdef AUTOMATIC_LOCKING_ENABLE
  292.     MGL_LOCK_AUTOMATIC,
  293.     MGL_LOCK_MANUAL,
  294.     MGL_LOCK_SMART,
  295. #endif
  296.     MGL_FLATFAN,
  297.     MGL_PERSPECTIVE_MAPPING,
  298.     MGL_W_ONE_HINT,
  299.     MGL_Z_OFFSET
  300. };
  301.  
  302. #define GL_COLOR_BUFFER_BIT     0x00000001
  303. #define GL_DEPTH_BUFFER_BIT     0x00000002
  304.  
  305. #define GL_TRUE                 1
  306. #define GL_FALSE                0
  307.  
  308. #define MGL_BUTTON_LEFT         0x00000001
  309. #define MGL_BUTTON_RIGHT        0x00000002
  310. #define MGL_BUTTON_MID          0x00000004
  311.  
  312. typedef struct MGLColor_t
  313. {
  314.     GLfloat r,g,b,a;
  315. } MGLColor;
  316.  
  317. typedef struct MGLNormal_t
  318. {
  319.     GLfloat x,y,z;
  320. } MGLNormal;
  321.  
  322. #include "mgl/vertexbuffer.h"
  323. #include "mgl/context.h"
  324. #include "mgl/clip.h"
  325.  
  326. /*
  327.     The current context is refered to as an extern variable, which
  328.     is a pointer to the context.
  329. */
  330.  
  331. extern GLcontext mini_CurrentContext;
  332.  
  333. #ifndef GLNDEBUG
  334.     #define GLASSERT(c) assert(c)
  335.     #define dprintf(x) printf x
  336. #else
  337.     #define GLASSERT(c)
  338.     #define dprintf(x)
  339. #endif
  340.  
  341. #ifndef GL_NOERRORCHECK
  342.     extern int kprintf(char *, ...);
  343.     #define GLFlagError(context,c,err) while ((c)) {\
  344.         context->CurrentError = err;\
  345.         kprintf("GLError: %ld at %s:%ld\n", (int)err, __FILE__,(int)__LINE__);\
  346.         return;\
  347.     }
  348. #else
  349.     #define GLFlagError(context,c,err)
  350. #endif
  351.  
  352.  
  353. /*
  354.     Prototypes and appropriate defines
  355.     These are derived from the OpenGL manpages
  356.     Some defines are duplicated with EXT suffix, to be compatible.
  357.     Additionally, some of these may not be needed (Maybe glBegin).
  358.     There may also be a problem with floating point parameters for
  359.     certain compilers. May be addressed in the macros.
  360. */
  361.  
  362. void        GLAlphaFunc(GLcontext context, GLenum func, GLclampf ref);
  363. //GLboolean   GLAreTexturesResident(GLcontext context, GLsizei n, const GLuint *textures, GLboolean *residences);
  364. //void        GLArrayElement(GLcontext context, GLint i);
  365. void        GLBegin(GLcontext context, GLenum mode);
  366. void        GLBindTexture(GLcontext context, GLenum target, GLuint texture);
  367. void        GLBlendFunc(GLcontext context, GLenum sfactor, GLenum dfactor);
  368. void        GLClear(GLcontext context, GLbitfield mask);
  369. void        GLClearColor(GLcontext context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
  370. void        GLClearDepth(GLcontext context, GLclampd depth);
  371. void        GLColor3fv(GLcontext context, GLfloat *v);
  372. void        GLColor3ubv(GLcontext context, GLubyte *v);
  373. void        GLColor4f(GLcontext context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
  374. void        GLColor4fv(GLcontext context, GLfloat *v);
  375. void        GLColor4ub(GLcontext context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alhpa);
  376. void        GLColor4ubv(GLcontext context, GLubyte *v);
  377. //void        GLColorPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  378. void        GLCullFace(GLcontext context, GLenum mode);
  379. void        GLDeleteTextures(GLcontext context, GLsizei n, const GLuint *textures);
  380. void        GLDepthFunc(GLcontext context, GLenum func);
  381. void        GLDepthMask(GLcontext context, GLboolean flag);
  382. void        GLDepthRange(GLcontext context, GLclampd n, GLclampd f);
  383. //void        GLDisableClientState(GLcontext context, GLenum cap);
  384. //void        GLDrawArrays(GLcontext context, GLenum mode, GLint first, GLsizei count);
  385. void        GLDrawBuffer(GLcontext context, GLenum mode);
  386. //void        GLDrawElements(GLcontext context, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
  387. //void        GLEdgeFlag(GLcontext context, GLboolean flag);
  388. //void        GLEdgeFlagPointer(GLcontext context, GLsizei stride, const GLboolean *flags);
  389. //void        GLEdgeFlagv(GLcontext context, const GLboolean *flag);
  390. //void        GLEnableClientState(GLcontext context, GLenum cap);
  391. void        GLEnd(GLcontext context);
  392. void        GLFinish(GLcontext context);
  393. void        GLFlush(GLcontext context);
  394. void        GLFogf(GLcontext context, GLenum pname, GLfloat param);
  395. void        GLFogfv(GLcontext context, GLenum pname, GLfloat *param);
  396. void        GLFrontFace(GLcontext context, GLenum mode);
  397. void        GLFrustum(GLcontext context, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  398. void        GLGenTextures(GLcontext context, GLsizei n, GLuint *textures);
  399. //void        GLGetBooleanv(GLcontext context, GLenum pname, GLboolean *params);
  400. //void        GLGetDoublev(GLcontext context, GLenum pname, GLdouble *params);
  401. GLenum      GLGetError(GLcontext context);
  402. void        GLGetFloatv(GLcontext context, GLenum pname, GLfloat *params);
  403. void        GLGetIntegerv(GLcontext context, GLenum pname, GLint *params);
  404. void        GLGetPointerv(GLcontext context, GLenum pname, GLvoid* *params);
  405. const GLubyte* GLGetString(GLcontext context, GLenum name);
  406. void        GLHint(GLcontext context, GLenum target, GLenum mode);
  407. //void        GLIndexi(GLcontext context, GLint c);
  408. //void        GLIndexiv(GLcontext context, const GLint *c);
  409. //void        GLIndexPointer(GLcontext context, GLenum type, GLsizei stride, const GLvoid *pointer);
  410. //void        GLInterleavedArrays(GLcontext context, GLenum format, GLsizei stride, const GLvoid *pointer);
  411. //GLboolean   GLIsEnabled(GLcontext context, GLenum cap);
  412. //GLboolean   GLIsTexture(GLcontext context, GLuint texture);
  413. void        GLLoadIdentity(GLcontext context);
  414. void        GLLoadMatrixd(GLcontext context, const GLdouble *m);
  415. void        GLLoadMatrixf(GLcontext context, const GLfloat *m);
  416. void        GLMatrixMode(GLcontext context, GLenum mode);
  417. void        GLMultMatrixd(GLcontext context, const GLdouble *m);
  418. void        GLMultMatrixf(GLcontext context, const GLfloat *m);
  419. void        GLNormal3f(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  420. void        GLOrtho(GLcontext context, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
  421. void        GLPixelStorei(GLcontext context, GLenum pname, GLint param);
  422. void        GLPolygonMode(GLcontext context, GLenum face, GLenum mode);
  423. //void        GLPolygonOffset(GLcontext context, GLfloat factor, GLfloat units);
  424. void        GLPopMatrix(GLcontext context);
  425. //void        GLPrioritizeTextures(GLcontext context, GLsizei n, const GLuint *textures, const GLclampf *priorities);
  426. void        GLPushMatrix(GLcontext context);
  427. //void        GLReadBuffer(GLcontext context, GLenum mode);
  428. void        GLReadPixels(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
  429. void        GLRotated(GLcontext context, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
  430. void        GLRotatef(GLcontext context, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
  431. void        GLScaled(GLcontext context, GLdouble x, GLdouble y, GLdouble z);
  432. void        GLScalef(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  433. void        GLScissor(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height);
  434. void        GLShadeModel(GLcontext context, GLenum mode);
  435. void        GLTexCoord2f(GLcontext context, GLfloat s, GLfloat t);
  436. void        GLTexCoord2fv(GLcontext context, GLfloat *v);
  437. //void        GLTexCoordPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  438. void        GLTexEnvi(GLcontext context, GLenum target, GLenum pname, GLint param);
  439. void        GLTexGeni(GLcontext context, GLenum coord, GLenum mode, GLenum map);
  440. void        GLTexImage2D(GLcontext context, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
  441. void        GLTexParameteri(GLcontext context, GLenum target, GLenum pname, GLint param);
  442. void        GLTexSubImage2D(GLcontext context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
  443. void        GLTranslated(GLcontext context, GLdouble x, GLdouble y, GLdouble z);
  444. void        GLTranslatef(GLcontext context, GLfloat x, GLfloat y, GLfloat z);
  445. void        GLVertex3fv(GLcontext context, GLfloat *v);
  446. void        GLVertex4f(GLcontext context, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
  447. void        GLVertex4fv(GLcontext context, GLfloat *v);
  448. //void        GLVertexPointer(GLcontext context, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
  449. void        GLViewport(GLcontext context, GLint x, GLint y, GLsizei width, GLsizei height);
  450. void        mglChooseNumberOfBuffers(int number);
  451. void        mglChoosePixelDepth(int depth);
  452. void        mglChooseTextureBufferSize(int size);
  453. void        mglChooseVertexBufferSize(int size);
  454. void *      MGLCreateContext(int offx, int offy, int w, int h);
  455. void        MGLDeleteContext(GLcontext context);
  456. void        MGLEnableSync(GLcontext context, GLboolean enable);
  457. void        MGLExit(GLcontext context);
  458. void *      MGLGetWindowHandle(GLcontext context);
  459. void        MGLIdleFunc(GLcontext context, IdleFn i);
  460. void        MGLKeyFunc(GLcontext context, KeyHandlerFn k);
  461. GLboolean   MGLLockDisplay(GLcontext context);
  462. void        MGLMainLoop(GLcontext context);
  463. void        MGLMouseFunc(GLcontext context, MouseHandlerFn m);
  464. void        mglProhibitAlphaFallback(GLboolean flag);
  465. void        mglProhibitMipMapping(GLboolean flag);
  466. void        mglProposeCloseDesktop(GLboolean closeme);
  467. void        MGLResizeContext(GLcontext context, GLsizei width, GLsizei height);
  468. void        MGLSetState(GLcontext context, GLenum cap, GLboolean state);
  469. void        MGLSpecialFunc(GLcontext context, SpecialHandlerFn s);
  470. void        MGLSwitchBuffer(GLcontext context, int bufnr);
  471. void        MGLSwitchDisplay(GLcontext context);
  472. void        MGLTexMemStat(GLcontext context, GLint *Current, GLint *Peak);
  473. void        MGLUnlockDisplay(GLcontext context);
  474. void        MGLWriteShotPPM(GLcontext context, char *filename);
  475. void        MGLInit(void);
  476. void        MGLTerm(void);
  477.  
  478. #ifdef AUTOMATIC_LOCKING_ENABLE
  479. void        MGLLockMode(GLcontext context, GLenum lockMode);
  480. #endif
  481.  
  482. void        MGLPrintMatrix(GLcontext context, int mode);
  483. void        MGLPrintMatrixStack(GLcontext context, int mode);
  484.  
  485. void        MGLSetZOffset(GLcontext context, GLfloat offset);
  486.  
  487. /*
  488. ** These macros define the OpenGL compatibility macros. If you don't want them,
  489. ** define NO_GL_MACROS before including this file. In this case, you might
  490. ** define the USE_GL_INLINES to include static inline functions that do the same.
  491. */
  492.  
  493. #ifdef NO_GL_MACROS
  494. #ifdef USE_GL_INLINES
  495. #include "mgl/minigl.h"
  496. #endif
  497. #else
  498. #define glAlphaFunc(func, ref) GLAlphaFunc(mini_CurrentContext, func, ref)
  499. #define glAreTexturesResident(n, textures, residences) GLAreTexturesResident(mini_CurrentContext, n, textures, residences)
  500. #define glArrayElement(i) GLArrayElement(mini_CurrentContext, i)
  501. #define glArrayElementEXT(i) GLArrayElement(mini_CurrentContext, i)
  502. #define glBegin(mode) GLBegin(mini_CurrentContext, mode)
  503. #define glEnd() GLEnd(mini_CurrentContext)
  504. #define glTexGeni(coord,mode,map) GLTexGeni(mini_CurrentContext, coord, mode, map)
  505. #define glBindTexture(target, texture) GLBindTexture(mini_CurrentContext, target, texture)
  506. #define glBlendFunc(sfactor, dfactor) GLBlendFunc(mini_CurrentContext, sfactor, dfactor)
  507. #define glClear(mask) GLClear(mini_CurrentContext, mask)
  508. #define glClearColor(red, green, blue, alpha) GLClearColor(mini_CurrentContext, red, green, blue, alpha)
  509. #define glClearDepth(depth) GLClearDepth(mini_CurrentContext, depth)
  510. #define glColorPointer(size, type, stride, pointer) GLColorPointer(mini_CurrentContext, size, type, stride, pointer)
  511. #define glColorPointerEXT(size, type, stride, pointer) GLColorPointer(mini_CurrentContext, size, type, stride, pointer)
  512. #define glCullFace(mode) GLCullFace(mini_CurrentContext, mode)
  513. #define glDeleteTextures(n, textures) GLDeleteTextures(mini_CurrentContext, n, textures)
  514. #define glDepthFunc(func) GLDepthFunc(mini_CurrentContext, func)
  515. #define glDepthMask(flag) GLDepthMask(mini_CurrentContext, flag)
  516. #define glEnable(cap) MGLSetState(mini_CurrentContext, cap, GL_TRUE)
  517. #define glDisable(cap) MGLSetState(mini_CurrentContext, cap, GL_FALSE)
  518. #define glDisableClientState(cap) GLDisableClientState(mini_CurrentContext, cap)
  519. #define glEnableClientState(cap) GLEnableClienState(mini_CurrentContext, cap)
  520. #define glDrawArrays(mode, first, count) GLDrawArrays(mini_CurrentContext, mode, first, count)
  521. #define glDrawArraysEXT(mode, first, count) GLDrawArrays(mini_CurrentContext, mode, first, count)
  522. #define glDrawBuffer(mode) GLDrawBuffer(mini_CurrentContext, mode)
  523. #define glDrawElements(mode, count, type, indices) GLDrawElements(mini_CurrentContext, mode, count, type, indices)
  524. #define glEdgeFlag(flag) GLEdgeFlag(mini_CurrentContext, flag)
  525. #define glEdgeFlagv(flag) GLEdgeFlagv(mini_CurrentContext, flag)
  526. #define glEdgeFlagPointer(stride, flags) GLEdgeFlagPointer(mini_CurrentContext, stride, flags)
  527. #define glEdgeFlagPointerEXT(stride, flags) GLEdgeFlagPointer(mini_CurrentContext, stride, flags)
  528. #define glFinish() GLFinish(mini_CurrentContext)
  529. #define glFlush() GLFlush(mini_CurrentContext)
  530. #define glFogf(pname, param) GLFogf(mini_CurrentContext, pname, param)
  531. #define glFogfv(pname, param) GLFogfv(mini_CurrentContext, pname, param)
  532. #define glFogi(pname, param) glFogf(pname, (GLfloat)param)
  533. #define glFrontFace(mode) GLFrontFace(mini_CurrentContext, mode)
  534. #define glFrustum(left, right, bottom, top, zNear, zFar) GLFrustum(mini_CurrentContext, left, right, bottom, top, zNear, zFar)
  535. #define glGenTextures(n, textures) GLGenTextures(mini_CurrentContext, n, textures)
  536. #define glGetError() GLGetError(mini_CurrentContext)
  537. #define glGetBooleanv(pname, params) GLGetBooleanv(mini_CurrentContext, pname, params);
  538. #define glGetDoublev(pname, params) GLGetDoublev(mini_CurrentContext, pname, params)
  539. #define glGetFloatv(pname, params) GLGetFloatv(mini_CurrentContext, pname, params)
  540. #define glGetIntegerv(pname, params) GLGetIntegerv(mini_CurrentContext, pname, params)
  541. #define glGetPointerv(pname, params) GLGetPointerv(mini_CurrentContext, pname, params)
  542. #define glGetPointervEXT(pname, params) GLGetPointerv(mini_CurrentContext, pname, params)
  543. #define glGetString(name) GLGetString(mini_CurrentContext, name)
  544. #define glHint(target, mode) GLHint(mini_CurrentContext, target, mode)
  545. #define glIndexi(c) GLIndexi(mini_CurrentContext, c)
  546. #define glIndexiv(c) GLIndexfv(mini_CurrentContext, c)
  547. #define glIndexPointer(type, stride, pointer) GLIndexPointer(mini_CurrentContext, type, stride, pointer)
  548. #define glIndexPointerEXT(type, stride, pointer) GLIndexPointer(mini_CurrentContext, type, stride, pointer)
  549. #define glInterleavedArrays(format, stride, pointer) GLInterleavedArrays(mini_CurrentContext, format, stride, pointer)
  550. #define glIsEnabled(cap) GLIsEnabled(mini_CurrentContext, cap)
  551. #define glIsTexture(texture) GLIsTexture(mini_CurrentContext, texture)
  552. #define glLoadIdentity() GLLoadIdentity(mini_CurrentContext)
  553. #define glLoadMatrixf(m) GLLoadMatrixf(mini_CurrentContext, m)
  554. #define glLoadMatrixd(m) GLLoadMatrixd(mini_CurrentContext, m)
  555. #define glMatrixMode(mode) GLMatrixMode(mini_CurrentContext, mode)
  556. #define glMultMatrixd(m) GLMultMatrixd(mini_CurrentContext, m)
  557. #define glMultMatrixf(m) GLMultMatrixf(mini_CurrentContext, m)
  558. #define glOrtho(left, right, bottom, top, zNear, zFar) GLOrtho(mini_CurrentContext, left, right, bottom, top, zNear, zFar)
  559. #define glPixelStorei(pname, param) GLPixelStorei(mini_CurrentContext, pname, param)
  560. #define glPixelStoref(pname, param) GLPixelStorei(mini_CurrentContext, pname, (int)(param))
  561. #define glPolygonMode(face, mode) GLPolygonMode(mini_CurrentContext, face, mode)
  562. #define glPolygonOffset(factor, units) GLPolygonOffset(mini_CurrentContext, factor, units)
  563. #define glPushMatrix() GLPushMatrix(mini_CurrentContext)
  564. #define glPopMatrix() GLPopMatrix(mini_CurrentContext)
  565. #define glPrioritizeTextures(n, textures, pri) GLPrioritizeTextures(mini_CurrentContext, n, textures, pri)
  566. #define glReadBuffer(mode) GLReadBuffer(mini_CurrentContext, mode)
  567. #define glReadPixels(x, y, width, height, format, type, pixels) GLReadPixels(mini_CurrentContext, x, y, width, height, format, type, pixels)
  568. #define glRotated(angle, x, y, z) GLRotated(mini_CurrentContext, angle, x, y, z)
  569. #define glRotatef(angle, x, y, z) GLRotatef(mini_CurrentContext, (angle), (x), (y), (z))
  570. #define glScaled(x, y, z) GLScaled(mini_CurrentContext, x, y, z)
  571. #define glScalef(x, y, z) GLScaled(mini_CurrentContext, (GLdouble)(x), (GLdouble)(y), (GLdouble)(z))
  572. #define glScissor(x, y, w, h) GLScissor(mini_CurrentContext, x, y, w, h)
  573. #define glShadeModel(mode) GLShadeModel(mini_CurrentContext, mode)
  574. #define glTexCoord2f(s, t) GLTexCoord2f(mini_CurrentContext, s, t)
  575. #define glTexCoord2fv(v) GLTexCoord2fv(mini_CurrentContext, v)
  576. #define glTexCoordPointer(size, type, stride, pointer) GLTexCoordPointer(mini_CurrentContext, size, type, stride, pointer)
  577. #define glTexCoordPointerEXT(size, type, stride, pointer) GLTexCoordPointer(mini_CurrentContext, size, type, stride, pointer)
  578. #define glTexImage2D(target, level, internal, width, height, border, format, type, pixels) GLTexImage2D(mini_CurrentContext, target, level, internal, width, height, border, format, type, pixels)
  579. #define glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels) GLTexSubImage2D(mini_CurrentContext, target, level, xoffset, yoffset, width, height, format, type, pixels)
  580. #define glTranslated(x, y, z) GLTranslated(mini_CurrentContext, x, y, z)
  581. #define glTranslatef(x, y, z) GLTranslatef(mini_CurrentContext, x, y, z)
  582. #define glViewport(x, y, width, height) GLViewport(mini_CurrentContext, x, y, width, height)
  583. #define glVertex4f(x,y,z,w) GLVertex4f(mini_CurrentContext, x,y,z,w)
  584. #define glVertex2f(x,y)     GLVertex4f(mini_CurrentContext, x,y, 0.f, 1.f)
  585. #define glVertex2i(x,y)     GLVertex4f(mini_CurrentContext, (GLfloat)x, (GLfloat)y, 0.f, 1.f)
  586. #define glVertex3f(x,y,z)   GLVertex4f(mini_CurrentContext, x,y,z,    1.f)
  587. #define glVertex3fv(v)      GLVertex3fv(mini_CurrentContext, v);
  588. #define glVertexPointer(size, type, stride, pointer) GLVertexPointer(mini_CurrentContext, size, type, stride, pointer)
  589. #define glVertexPointerEXT(size, type, stride, pointer) GLVertexPointer(mini_CurrentContext, size, type, stride, pointer)
  590. #define glDepthRange(n,f) GLDepthRange(mini_CurrentContext, n,f)
  591. #define mglCreateContext(offx, offy, w, h) mini_CurrentContext = MGLCreateContext(offx, offy, w,h)
  592. #define mglResizeContext(width, height) MGLResizeContext(mini_CurrentContext, width, height)
  593. #define mglSwitchBuffer(bufnr) MGLSwitchBuffer(mini_CurrentContext, bufnr)
  594. #define mglDeleteContext() MGLDeleteContext(mini_CurrentContext)
  595. #define mglGetWindowHandle() MGLGetWindowHandle(mini_CurrentContext)
  596. #define mglSwitchDisplay() MGLSwitchDisplay(mini_CurrentContext)
  597. #define mglLockDisplay() MGLLockDisplay(mini_CurrentContext)
  598. #define mglUnlockDisplay() MGLUnlockDisplay(mini_CurrentContext)
  599. #define glColor4f(red, green, blue, alpha)  GLColor4f(mini_CurrentContext, red, green, blue, alpha)
  600. #define glColor4fv(v)                       GLColor4fv(mini_CurrentContext, v)
  601. #define glColor3f(red,green,blue)           GLColor4f(mini_CurrentContext, red, green, blue, 1.0)
  602. #define glColor3fv(v)                       GLColor3fv(mini_CurrentContext,v)
  603. #define glColor4ub(r,g,b,a) GLColor4ub(mini_CurrentContext, r,g,b,a)
  604. #define glColor4ubv(v)      GLColor4ubv(mini_CurrentContext, v)
  605. #define glColor3ub(r,g,b)   GLColor4ub(mini_CurrentContext, r,g,b,255)
  606. #define glColor3ubv(v)      GLColor4ub(mini_CurrentContext, v)
  607. #define glNormal3f(x,y,z) GLNormal3f(mini_CurrentContext, x,y,z)
  608. #define glTexEnvi(target, pname, param) GLTexEnvi(mini_CurrentContext, target, pname, param)
  609. #define glTexEnvf(target, pname, param)  GLTexEnvi(mini_CurrentContext, target, pname, (GLint)param)
  610. #define glTexEnviv(target, pname, param) glTexEnvi(target, pname, *(param))
  611. #define glTexEnvfv(target, pname, param) glTexEnvi(target, pname, (GLint)(*(param)))
  612. #define glTexParameteri(target, pname, param) GLTexParameteri(mini_CurrentContext, target, pname, param)
  613. #define glTexParameterf(target, pname, param) glTexParameteri(target, pname, (GLint)param)
  614. #define glTexParameteriv(target, pname, param) glTexParameteri(target, pname, *(param))
  615. #define glTexParameterfv(target, pname, param) glTexParameteri(target, pname, (GLint)*(param))
  616. #define mglEnableSync(enable) MGLEnableSync(mini_CurrentContext, enable)
  617. #define mglWriteShotPPM(filename) MGLWriteShotPPM(mini_CurrentContext, filename)
  618. #define mglTexMemStat(Current, Peak) MGLTexMemStat(mini_CurrentContext, Current, Peak)
  619.  
  620. #ifdef AUTOMATIC_LOCKING_ENABLE
  621. #define mglLockMode(lockMode) MGLLockMode(mini_CurrentContext, lockMode)
  622. #endif
  623.  
  624. #define mglKeyFunc(k) MGLKeyFunc(mini_CurrentContext, k)
  625. #define mglSpecialFunc(s) MGLSpecialFunc(mini_CurrentContext, s)
  626. #define mglMouseFunc(m) MGLMouseFunc(mini_CurrentContext, m)
  627. #define mglIdleFunc(i) MGLIdleFunc(mini_CurrentContext, i)
  628.  
  629. #define mglExit() MGLExit(mini_CurrentContext)
  630. #define mglMainLoop() MGLMainLoop(mini_CurrentContext)
  631.  
  632. #ifndef GLNDEBUG
  633. #define mglPrintMatrix(mode) MGLPrintMatrix(mini_CurrentContext, mode)
  634. #define mglPrintMatrixStack(mode) MGLPrintMatrixStack(mini_CurrentContext, mode)
  635. #endif
  636.  
  637. #endif
  638.  
  639. #ifdef __cplusplus
  640. }
  641. #endif
  642.  
  643.  
  644. #endif
  645.